import { Utils } from './../../common/util';
import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
import { BusiProvider } from '../../providers/busi/busi';
import { NativeProvider } from '../../providers/native/native';

/**
 * Generated class for the RegisterPage page.
 *
 * See https://ionicframework.com/docs/components/#navigation for more info on
 * Ionic pages and navigation.
 */

@IonicPage()
@Component({
  selector: 'page-register',
  templateUrl: 'register.html',
})
export class RegisterPage {
  xb:any;
  csrq:any;
  xm:any;
  sjh:any;
  sfzhm:any;
  jtzz:any;
  username:any;
  password:any;
  util = new Utils();
  constructor(public navCtrl: NavController, public navParams: NavParams,private busi:BusiProvider,private native:NativeProvider) {
    this.csrq = this.util.getIonCurrentDateString();
  }

  ionViewDidLoad() {
    console.log('ionViewDidLoad RegisterPage');
  }
  saveuser(){
    let body={
      username:this.username,
      xb:this.xb,
      sjh:this.sjh,
      csrq:this.csrq,
      sfzhm:this.sfzhm,
      jtzz:this.jtzz,
      password:this.password,
      xm:this.xm
    }
    this.busi.userAdd(body).subscribe(
      data=>{
        this.native.showToast("注册成功！");
        this.navCtrl.pop();
      },
      err=>{

      }
    );
  }

}
